All Questions
17 questions
1vote
2answers
71views
Use sed to insert a character in an xml file
I have an xml file with content following this format: <type:color>000000</type:color> <type:color>FFFFFF</type:color> The information within the tags are hex colors (many ...
-2votes
1answer
72views
Parse txt file on basis of occurrence of a tag in Linux
I am trying to parse a txt file containing xml "messages"in linux, something like this <Document abc xyz .....> <hji> xyz </hji> </Document> <Document abc xyz ........
-1votes
3answers
129views
sed inline not working to modify XML-style input
the problem is that I cannot put the complete command on a line with SED, I had already done it but with those file it does not work: my exemple : <file>Documents/time/text1</file> //2X ...
0votes
1answer
1kviews
replacing value in xml file using sed value from variable missing ""s
hi can some one please help me here i am trying to replace value in tomcat server.xml file username using sed command <Resource username="user1" password="xxxxxxxx"/> below ...
-1votes
1answer
1kviews
How to extract mutliple text lines within xml file by using grep and/or sed
I am trying to extract some lines within a <w:t> tag in front and </w:t> tag at the end of the text I want, but im only getting the text within last tags and not the others. How can i do ...
0votes
5answers
4kviews
How to insert a newline character after each occurrence of a specific XML tag in a file?
How to insert a newline character after each occurrence of a specific XML tag in a file? My file has multiple tags </Data> and I want to insert a NewLine character after each </Data> tag I'...
-1votes
2answers
491views
how to append a line alignment with its previous line in linux?
I have many xml files. There is a line end with </autoReferenceLines>. The line may have different leading spaces in different files. I want to add a new line below that line with the same ...
1vote
3answers
613views
Linux sed regex escape
I use sed -i to replace the port value in a xml file, <property name="port" value="8954" /> But I don't know how escape the regex, my regex is below. (?<=name="port"\s+value=")\d+(?=") my ...
1vote
1answer
93views
sed - include all found in between 2 pattern, except what's found between other pattern
I have a sed pattern search as below: sed -n '/<centerline/,/<\/centerline/p' This finds everything in between <centerline> and </centerline> I want to ignore all the cases where I ...
0votes
3answers
2kviews
how to find & replace a file path listed in a file
I have a file content as shown below. If a line has ".idt" word, then I need to check if there is a file path preceding it (eg: /bin/dir/test/abcdef.idt). If yes, then remove the file path and keep ...
0votes
3answers
4kviews
How to extract the XML from a log entry?
We are logging XML messages to a downstream system in our logs. I am trying to use sed to extract the XML from the log entry, but not sure exactly how to use it. This is a typical log entry: 2018-...
0votes
4answers
5kviews
find + how to print the file name when grep is matched [duplicate]
the following useful find command , print the value from Name tag find /tmp -type f -name '*.xml' -exec grep -o -P '(?<=<Name>).*(?=</Name>)' {} \; the problem is in case we have ...
1vote
1answer
2kviews
how to verify XML that include specific tags
is it possible to check by xmllint if xml include the follwing tags: Name uniq_String Version example of xml with three tags: <?xml version="1.0" encoding="UTF-8" ?> <!-- tasks configuration ...
0votes
2answers
3kviews
How can i parse a xml file from the http URL without downloading the file and print the desired string?
Hi i am not sure if this is possible, i have checked over google many options. For example if i have a http URL which has xml content : http://server.com/lastBuild/api/xml content would be something ...
0votes
6answers
754views
From gpx to csv file
<wpt lat="1.345529841" lon="103.7577152"><time>2010-01-01T00:00:00Z</time</wpt> <wpt lat="1.345529841" lon="103.7577152"><time>2010-01-01T00:00:00Z</time></...